#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.

usePermissiveRulesForSamplesAndTests()

#this is CMakeLists.txt for the folder tests of C shared utility
set(SHARED_UTIL_REAL_TEST_FOLDER ${CMAKE_CURRENT_LIST_DIR}/real_test_files CACHE INTERNAL "this is what needs to be included when doing test sources" FORCE)

if(${run_unittests})
    add_subdirectory(agenttime_ut)
    add_subdirectory(azure_base32_ut)
    add_subdirectory(azure_base64_ut)
    add_subdirectory(buffer_ut)
    add_subdirectory(constbuffer_array_ut)
    if(${use_condition})
        add_subdirectory(condition_ut)
    endif()
    add_subdirectory(constbuffer_ut)
    add_subdirectory(constmap_ut)
    add_subdirectory(crtabstractions_ut)
    add_subdirectory(doublylinkedlist_ut)
    add_subdirectory(gballoc_ut)
    add_subdirectory(gballoc_without_init_ut)
    add_subdirectory(hmacsha256_ut)
    if(${use_http})
        add_subdirectory(httpapiex_ut)
        add_subdirectory(httpapiexsas_ut)
        add_subdirectory(httpheaders_ut)
        add_subdirectory(httpapicompact_ut)
    endif()
    add_subdirectory(singlylinkedlist_ut)
    add_subdirectory(lock_ut)    
    add_subdirectory(map_ut)
    add_subdirectory(refcount_ut)
    add_subdirectory(sastoken_ut)
    add_subdirectory(connectionstringparser_ut)
    if(WIN32)
        add_subdirectory(srw_lock_ut)
        add_subdirectory(socketio_win32_ut)
        add_subdirectory(x509_schannel_ut)
        add_subdirectory(platform_win32_ut)
    else()
        add_subdirectory(socketio_berkeley_ut)
    endif()

    #normally, with proper include paths, the below tests can be run under windows too.
    if(${use_openssl})
        add_subdirectory(x509_openssl_ut)
    endif()

    add_subdirectory(string_tokenizer_ut)
    add_subdirectory(string_token_ut)
    add_subdirectory(strings_ut)
    add_subdirectory(tickcounter_ut)
    add_subdirectory(tlsio_options_ut)
    add_subdirectory(uniqueid_ut)
    add_subdirectory(uuid_ut)
    add_subdirectory(urlencode_ut)
    add_subdirectory(vector_ut)
    add_subdirectory(xio_ut)
    add_subdirectory(optionhandler_ut)
    add_subdirectory(memory_data_ut)

    if(use_wolfssl)
        add_subdirectory(tlsio_wolfssl_ut)
    endif()

    if(use_wsio)
        add_subdirectory(uws_client_ut)
        add_subdirectory(uws_frame_encoder_ut)
        add_subdirectory(wsio_ut)
        add_subdirectory(ws_url_ut)
    endif()

    #Add adapters tests
    add_subdirectory(tickcounter_freertos_ut)
    if(use_cyclonessl AND WIN32)
        add_subdirectory(tlsio_cyclonessl_ut)
        add_subdirectory(tlsio_cyclonessl_socket_bsd_ut)
    endif()

    if(use_mbedtls)
        add_subdirectory(tlsio_mbedtls_ut)
    endif()

    add_subdirectory(utf8_checker_ut)
    add_subdirectory(http_proxy_io_ut)
    if(NOT DEFINED MACOSX)
        add_subdirectory(tlsio_esp8266_ut)
        add_subdirectory(socket_async_ut)
        add_subdirectory(dns_async_ut)
    endif()

    #Add template as reference for new tests
    add_subdirectory(template_ut)
endif()

if(${run_int_tests})
    if(WIN32)
        add_subdirectory(x509_schannel_int)
        add_subdirectory(string_utils_int)
    endif()
endif()
